package com.dja.nzw.mq.rabbit.config;

/**
 * Created by shuyun on 2016/8/8.
 */
public class AMQPConfig {
    private String address;

    private String username;

    private String passport;

    private String virtualhost;

    private int requestedHeartBeat=150;

    private boolean autoStartUp=false;

    private int declarationRetries=100000000;

    private int recoveryInterval=30000;

    private Integer concurrentConsumers;
    private Integer maxConcurrentConsumers;

    private final Integer  defaultConcurrentConsumers = 20;
    private final Integer  defaultMaxConcurrentConsumers = 50;

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassport() {
        return passport;
    }

    public void setPassport(String passport) {
        this.passport = passport;
    }

    public String getVirtualhost() {
        return virtualhost;
    }

    public void setVirtualhost(String virtualhost) {
        this.virtualhost = virtualhost;
    }

    public int getRequestedHeartBeat() {
        return requestedHeartBeat;
    }

    public void setRequestedHeartBeat(int requestedHeartBeat) {
        this.requestedHeartBeat = requestedHeartBeat;
    }

    public boolean isAutoStartUp() {
        return autoStartUp;
    }

    public void setAutoStartUp(boolean autoStartUp) {
        this.autoStartUp = autoStartUp;
    }

    public int getDeclarationRetries() {
        return declarationRetries;
    }

    public void setDeclarationRetries(int declarationRetries) {
        this.declarationRetries = declarationRetries;
    }

    public int getRecoveryInterval() {
        return recoveryInterval;
    }

    public void setRecoveryInterval(int recoveryInterval) {
        this.recoveryInterval = recoveryInterval;
    }

    public Integer getConcurrentConsumers() {
        if(this.concurrentConsumers == null){
            concurrentConsumers = defaultConcurrentConsumers;
        }
        return concurrentConsumers;
    }

    public void setConcurrentConsumers(Integer concurrentConsumers) {
        this.concurrentConsumers = concurrentConsumers;
    }

    public Integer getMaxConcurrentConsumers() {
        if(this.maxConcurrentConsumers == null){
            maxConcurrentConsumers = defaultMaxConcurrentConsumers;
        }
        return maxConcurrentConsumers;
    }

    public void setMaxConcurrentConsumers(Integer maxConcurrentConsumers) {
        this.maxConcurrentConsumers = maxConcurrentConsumers;
    }

    public Integer getDefaultConcurrentConsumers() {
        return defaultConcurrentConsumers;
    }

    public Integer getDefaultMaxConcurrentConsumers() {
        return defaultMaxConcurrentConsumers;
    }
}
